<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
</head>
<style>
  ul {
    width: 300px;
  }

  li {
    height: 40px;
    border-bottom: 1px solid #000;
  }
</style>

<body>
  <div>
    <ul>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
      <li>1</li>
    </ul>
  </div>
  <script>
    const oLis = document.querySelectorAll("ul li");
    function enter() {
      console.log(1);
      this.style.background = "red";
    }
    function leave() {
      console.log(2);
      this.style.background = "";
    }

    const throttleEnter = _.throttle(enter, 10, {
      // trailing: true,
      trailing: false,
      leading: true,
    });
    // const throttleLeave = _.throttle(leave, 10, {
    //   trailing: true,
    //   leading: true,
    // });

    oLis.forEach((item) => {
      item.onmouseenter = throttleEnter;
      // item.onmouseleave = throttleLeave;
      item.onmouseleave = leave;
    });
  </script>
</body>
<script>




</script>

</html>